*Description: See README File

use "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\ICPSR_35206\DS0004\35206-0004-Data.dta", clear
drop if COUNTY~=0
gen facres_1860=ACIMP+ ACUNIMP
label var facres_1860 "acres in farms 1860"
gen fiacres_1860=ACIMP
label var fiacres_1860 "acres improved in farms 1860"
gen farms_1860 =FARM39+ FARM1019+ FARM2049+ FARM5099+ FARM100+ FARM500+ FARM1000 
label var farms_1860 "number of farms 1860"
rename FARM1000 farm1000_1860
rename FARM500 farm500_1860
gen avfsize_1860=facres_1860/farms_1860
label var avfsize_1860 "average farms size in 1860, acres"
rename FARMVAL farmval_1860
keep STATE NAME facres_1860 farms_1860 farm1000_1860  farm500_1860 avfsize_1860 farmval_1860 fiacres_1860
replace NAME ="MASSACHUSETTS" if NAME=="MASSACHUSETT"
replace NAME ="NORTH CAROLINA" if NAME=="NORTH CAROLI"
save "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1860.dta", replace

use "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\ICPSR_35206\DS0005\35206-0005-Data.dta", clear
drop if COUNTY~=0
rename TOTPOP pop_1870
gen facres_1870=ACIMP+ ACWOODS+ ACUNIOTH
label var facres_1870 "acres in farms 1870"
gen fiacres_1870=ACIMP
label var fiacres_1870 "acres improved in farms 1870"
rename FARMS farms_1870
label var farms_1870 "number of farms 1870"
rename FARM1000 farm1000_1870
rename FARM500 farm500_1870
gen avfsize_1870=facres_1870/farms_1870
label var avfsize_1870 "average farms size in 1870, acres"
rename FARMVAL farmval_1870
keep STATE NAME pop_1870 facres_1870 farms_1870 farm1000_1870  farm500_1870 avfsize_1870 farmval_1870 fiacres_1870
save "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1870.dta", replace

use "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\ICPSR_35206\DS0006\35206-0006-Data.dta", clear
drop if COUNTY~=0
rename TOTPOP pop_1880
rename FARMS farms_1880
label var farms_1880 "number of farms 1880"
rename FARM1000 farm1000_1880
rename FARM500 farm500_1880
rename FARMSIZE avfsize_1880
label var avfsize_1880 "average farms size in 1880, acres"
rename ACRES facres_1880
label var facres_1880 "acres in farms 1880"
gen fiacres_1880=ACIMP
label var fiacres_1880 "acres improved in farms 1880"
rename FARMVAL farmval_1880
keep STATE NAME pop_1880 facres_1880 farms_1880 farm1000_1880  farm500_1880 avfsize_1880 farmval_1880 fiacres_1880
save "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1880.dta", replace

use "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\ICPSR_35206\DS0007\35206-0007-Data.dta", clear
drop if COUNTY~=0
rename TOTPOP pop_1890
rename FARMS farms_1890
label var farms_1890 "number of farms 1890"
rename FARM1000 farm1000_1890
rename FARM500 farm500_1890
rename FARMSIZE avfsize_1890
label var avfsize_1890 "average farms size in 1890, acres"
rename FARMAREA facres_1890
label var facres_1890 "acres in farms 1890"
gen fiacres_1890=ACIMP
label var fiacres_1890 "acres improved farmland 1890"
rename FARMVAL farmval_1890
keep STATE NAME pop_1890 facres_1890 farms_1890 farm1000_1890  farm500_1890 avfsize_1890 farmval_1890 fiacres_1890
save "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1890.dta", replace

use "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\ICPSR_35206\DS0008\35206-0008-Data.dta", clear
drop if COUNTY~=0
rename TOTPOP pop_1900
rename FARMS farms_1900
label var farms_1900 "number of farms 1900"
rename FARM1000 farm1000_1900
rename FARM500 farm500_1900
rename FARMSIZE avfsize_1900
label var avfsize_1900 "average farms size in 1900, acres"
rename ACFARM facres_1900
label var facres_1900 "acres in farms 1900"
gen fiacres_1900=ACIMP
label var fiacres_1900 "acres improved farmland 1900"
rename FARMVAL farmval_1900
rename TOTVAL totfarmval_1900
keep STATE NAME pop_1900 facres_1900 farms_1900 farm1000_1900  farm500_1900 avfsize_1900 farmval_1900 totfarmval_1900 fiacres_1900
save "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1900.dta", replace

use "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\ICPSR_35206\DS0009\35206-0009-Data.dta", clear
drop if COUNTY~=0
rename TOTPOP pop_1910
rename FARMS farms_1910
label var farms_1910 "number of farms 1910"
rename FARM1000 farm1000_1910
rename FARM500 farm500_1910
rename FARMLAND facres_1910
label var facres_1910 "acres in farms 1910"
gen fiacres_1910=IMPAC
label var fiacres_1910 "acres improved farmland 1910"
gen avfsize_1910=facres_1910/farms_1910
label var avfsize_1910 "average farms size in 1910, acres"
rename FARMVAL farmval_1910
rename TOTVAL totfarmval_1910
keep STATE NAME pop_1910 facres_1910 farms_1910 farm1000_1910  farm500_1910 avfsize_1910 farmval_1910 totfarmval_1910 fiacres_1910
save "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1910.dta", replace

use "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\ICPSR_35206\DS0010\35206-0010-Data.dta", clear
drop if COUNTY~=0
rename TOTPOP pop_1920
rename VAR1 farms_1920
label var farms_1920 "number of farms 1920"
rename VAR16 farm1000_1920
rename VAR15 farm500_1920
rename VAR18 facres_1920
label var facres_1920 "acres in farms 1920"
gen avfsize_1920=facres_1920/farms_1920
label var avfsize_1920 "average farms size in 1920, acres"
rename VAR23 farmval_1920
rename VAR22 totfarmval_1920
gen fiacres_1920=VAR19
label var fiacres_1920 "acres improved farmland 1910"
rename VAR21 woodacres_1920
keep STATE NAME pop_1920 facres_1920 farms_1920 farm1000_1920  farm500_1920 avfsize_1920 farmval_1920  fiacres_1920 woodacres_1920
save "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1920.dta", replace

use "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\ICPSR_35206\DS0013\35206-0013-Data.dta", clear
drop if COUNTY~=0
rename VAR1 pop_1930
rename VAR2 farms_1930
label var farms_1930 "number of farms 1930"
rename VAR6 totarea_1930 
gen farm1000_1930 =VAR93+ VAR94
label var farm1000_1930 "Farms, 1000 acres and over, 1930"
rename VAR93 farm500_1930
rename VAR8 facres_1930
label var facres_1930 "acres in farms 1930"
rename VAR11 avfsize_1930
label var avfsize_1930 "average farms size in 1930, acres"
rename VAR121 farmval_1930
rename VAR120 totfarmval_1930 
gen cropacres_1930 = VAR12 + VAR17
label var cropacres_1930 "total cropland acres (harvested + failed + idle + plowable pasture)"
gen woodacres_1930 = VAR18 + VAR20
label var woodacres_1930 "total woodland acres (pasture + non-pasture)"
gen pastacres_1930 = VAR19
label var pastacres_1930 "Other pasture (not cropland & not woodland)"
//(this is an improved farmland category with total cropland according to https://agupubs.onlinelibrary.wiley.com/doi/full/10.1029/2001GB001843)
keep STATE NAME pop_1930 facres_1930 farms_1930 farm1000_1930  farm500_1930 avfsize_1930 farmval_1930 totfarmval_1930 totfarmval_1930 cropacres_1930 woodacres_1930 pastacres_1930
save "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1930.dta", replace

use "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\ICPSR_35206\DS0015\35206-0015-Data.dta", clear
drop if COUNTY~=0
rename VAR2 farms_1935
label var farms_1935 "number of farms 1935"
rename VAR9 totarea_1935 
rename VAR12 facres_1935
label var facres_1935 "acres in farms 1935"
rename VAR11 avfsize_1935
label var avfsize_1935 "average farms size in 1935, acres"
rename VAR217 farm1000_1935 
label var farm1000_1935 "Farms, 1000 acres and over, 1935"
gen farm500_1935 =VAR215+ VAR216
label var farm500_1935 "Farms, 500 to 999 acres, 1935"
rename VAR19 totfarmval_1935
gen cropacres_1935 = VAR29 + VAR31 + VAR33 + VAR35
label var cropacres_1935 "total cropland acres (harvested + failed + idle + plowable pasture)"
gen woodacres_1935 = VAR36 + VAR38
label var woodacres_1935 "total woodland acres (pasture + non-pasture)"
gen pastacres_1935 = VAR37
label var pastacres_1935 "Other pasture (not cropland & not woodland)"
keep STATE NAME facres_1935 farms_1935 farm1000_1935  farm500_1935 avfsize_1935 totfarmval_1935 cropacres_1935 woodacres_1935 pastacres_1935
**NOTE: THE VALUES FOR  farms by size do not make sense, so I am cutting them**
drop farm500_1935 farm1000_1935
save "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1935.dta", replace

use "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\ICPSR_35206\DS0016\35206-0016-Data.dta", clear
drop if COUNTY~=0
drop if STATEFIP==.
rename VAR2 urbpop_1940
rename VAR4 farms_1940
label var farms_1940 "number of farms 1940"
rename VAR5 totarea_1940 
rename VAR7 facres_1940
label var facres_1940 "acres in farms 1940"
rename VAR8 avfsize_1940
label var avfsize_1940 "average farms size in 1940, acres"
rename VAR129 farm1000_1940 
label var farm1000_1940 "Farms, 1000 acres and over, 1940"
gen farm500_1940 =VAR127+ VAR128
label var farm500_1940 "Farms, 500 to 999 acres, 1940"
rename VAR29 totfarmval_1940
gen farmval_1940=totfarmval_1940- VAR31
gen cropacres_1940 = VAR10 + VAR12 + VAR14 + VAR16
label var cropacres_1940 "total cropland acres (harvested + failed + idle + plowable pasture)"
rename VAR18 woodacres_1940
label var woodacres_1940 "total woodland acres"
label var farmval_1940 "Total value of farms minus value of buildings, 1940" 
keep STATE NAME STATEFIP facres_1940 farms_1940 farm1000_1940  farm500_1940 avfsize_1940 totfarmval_1940 farmval_1940 cropacres_1940 woodacres_1940
save "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1940.dta", replace

use "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\ICPSR_35206\DS0020\35206-0020-Data.dta", clear
drop if COUNTY~=0
drop if STATEFIP==.
rename VAR1 farmpop_1940
rename VAR2 farms_1945
label var farms_1945 "number of farms 1945"
rename VAR4 facres_1945
label var facres_1945 "acres in farms 1945"
rename VAR7 avfsize_1945
label var avfsize_1945 "average farms size in 1945, acres"
rename VAR681 farm1000_1945 
label var farm1000_1945 "Farms, 1000 acres and over, 1945"
gen farm500_1945 =VAR679+ VAR680
label var farm500_1945 "Farms, 500 to 999 acres, 1945"
rename VAR39 totfarmval_1945
rename VAR32 cropacres_1945
label var cropacres_1945 "total cropland acres (harvested + failed + idle + pasture)"
rename VAR38 woodacres_1945
label var woodacres_1945 "total woodland acres (pasture + non pasture)"
rename VAR26 pastacres_1945
label var pastacres_1945 "Other pasture (not cropland & not woodland)"
keep STATE NAME STATEFIP facres_1945 farms_1945 farm1000_1945  farm500_1945 avfsize_1945 totfarmval_1945 cropacres_1945 pastacres_1945 woodacres_1945
save "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1945.dta", replace

clear
use "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\ICPSR_35206\DS0021\35206-0021-Data.dta"
drop if COUNTY~=0
drop if STATEFIP==.
rename VAR1 farms_1950
label var farms_1950 "number of farms 1950"
rename VAR8 facres_1950
label var facres_1950 "acres in farms 1950"
rename VAR9 avfsize_1950
label var avfsize_1950 "average farms size in 1950, acres"
rename VAR113 farm1000_1950 
label var farm1000_1950 "Farms, 1000 acres and over, 1950"
rename VAR112 farm500_1950 
label var farm500_1950 "Farms, 500 to 999 acres, 1950"
gen totfarmval_1950=farms_1950*VAR10
label var totfarmval_1950 "value of land & buildings, 1950"
gen cropacres_1950 = VAR15 + VAR24+ VAR26
label var cropacres_1950 "total cropland acres (harvested plus pasture + non-harvested non-pasture)"
gen woodacres_1950 = VAR35 + VAR37
label var woodacres_1950 "total woodland acres pastured plus non-pasture"
gen pastacres_1950 = VAR39 
label var pastacres_1950 "other pasture acres (explicitly non-woodland non-crop)
keep STATE NAME STATEFIP facres_1950 farms_1950 farm1000_1950  farm500_1950 avfsize_1950 totfarmval_1950 cropacres_1950 pastacres_1950 woodacres_1950
save "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1950.dta", replace

//clear
//use "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\ICPSR_35206\DS0025\35206-0025-Data.dta", clear
//drop if COUNTY~=0
//rename VAR1 farms_1954
//label var farms_1954 "number of farms 1954"
//rename VAR8 facres_1954
//label var facres_1954 "acres in farms 1954"
//rename VAR9 avfsize_1954
//label var avfsize_1954 "average farms size in 1954, acres"
//rename VAR200 farm1000_1954 
//label var farm1000_1954 "Farms, 1000 acres and over, 1954"
//rename VAR199 farm500_1954 
//label var farm500_1954 "Farms, 500 to 999 acres, 1954"
//gen totfarmval_1954=farms_1954*VAR10
//label var totfarmval_1954 "value of land & buildings, 1954"
//keep STATE NAME facres_1954 farms_1954 farm1000_1954  farm500_1954 avfsize_1954 totfarmval_1954
//save "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1954.dta", replace

use "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\ICPSR_35206\DS0027\35206-0027-Data.dta", clear
drop if COUNTY~=0
rename VAR1 farms_1959
label var farms_1959 "number of farms 1959"
rename VAR5 facres_1959
label var facres_1959 "acres in farms 1959"
rename VAR6 avfsize_1959
label var avfsize_1959 "average farms size in 1959, acres"
gen farm1000_1959 = VAR148+VAR147
label var farm1000_1959 "Farms, 1000 acres and over, 1959"
rename VAR146 farm500_1959 
label var farm500_1959 "Farms, 500 to 999 acres, 1959"
gen totfarmval_1959=farms_1959*VAR8
label var totfarmval_1959 "value of land & buildings, 1959"
gen cropacres_1959 = VAR11 + VAR22+ VAR24
label var cropacres_1959 "total cropland acres (harvested plus pasture + non-harvested non-pasture)"
gen woodacres_1959 = VAR38 + VAR40
label var woodacres_1959 "total woodland acres pastured plus non-pasture"
gen pastacres_1959 = VAR42 
label var pastacres_1959 "other pasture acres (presumably non-woodland non-crop)"
keep STATE NAME facres_1959 farms_1959 farm1000_1959  farm500_1959 avfsize_1959 totfarmval_1959 cropacres_1959 woodacres_1959 pastacres_1959
save "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1959.dta", replace

use "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\ICPSR_35206\DS0030\35206-0030-Data.dta", clear
drop if COUNTY~=0
rename VAR1 farms_1964
label var farms_1964 "number of farms 1964"
rename VAR2 totarea_1964 
rename VAR4 facres_1964
label var facres_1964 "acres in farms 1964"
rename VAR5 avfsize_1964
label var avfsize_1964 "average farms size in 1964, acres"
gen farm1000_1964 = VAR103+VAR104
label var farm1000_1964 "Farms, 1000 acres and over, 1964"
rename VAR102 farm500_1964 
label var farm500_1964 "Farms, 500 to 999 acres, 1964"
gen totfarmval_1964=farms_1964*VAR6
label var totfarmval_1964 "value of land & buildings, 1964"
gen cropacres_1964 = VAR10 + VAR21+ VAR23
label var cropacres_1964 "total cropland acres (harvested plus pasture + non-harvested non-pasture)"
gen woodacres_1964 = VAR33 + VAR35
label var woodacres_1964 "total woodland acres pastured plus non-pasture"
gen pastacres_1964 = VAR37 
label var pastacres_1964 "other pasture acres (presumably non-woodland non-crop)"
keep STATE NAME facres_1964 farms_1964 farm1000_1964  farm500_1964 avfsize_1964 totfarmval_1964 cropacres_1964 woodacres_1964 pastacres_1964
save "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1964.dta", replace

use "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\ICPSR_35206\DS0033\35206-0033-Data.dta", clear
drop if COUNTY~=0
rename ITEM01001 farms_1969
label var farms_1969 "number of farms 1969"
rename ITEM01004 totarea_1969 
rename ITEM01002 facres_1969
label var facres_1969 "acres in farms 1969"
rename ITEM01003 avfsize_1969
gen farm1000_1969 = ITEM01019+ ITEM01020
label var farm1000_1969 "Farms, 1000 acres and over, 1969"
rename ITEM01018 farm500_1969 
label var farm500_1969 "Farms, 500 to 999 acres, 1969"
rename ITEM01006 totfarmval_1969
rename ITEM01036 cropacres_1969
label var cropacres_1969 "total cropland acres (whether or not pastured, fallow, failed, cultivated etc)"
rename ITEM01053 woodacres_1969 
label var woodacres_1969 "total woodland acres (whether pastured or not)"
keep STATE NAME FIPS facres_1969 farms_1969 farm1000_1969  farm500_1969 avfsize_1969 totfarmval_1969 cropacres_1969 woodacres_1969
save "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1969.dta", replace

use "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\ICPSR_35206\DS0036\35206-0036-Data.dta", clear
drop if COUNTY~=0
rename ITEM01001 farms_1974
label var farms_1974 "number of farms 1974"
rename ITEM01004 totarea_1974 
rename ITEM01002 facres_1974
label var facres_1974 "acres in farms 1974"
rename ITEM01003 avfsize_1974
gen farm1000_1974 = ITEM01019+ ITEM01020
label var farm1000_1974 "Farms, 1000 acres and over, 1974"
rename ITEM01018 farm500_1974 
label var farm500_1974 "Farms, 500 to 999 acres, 1974"
rename ITEM01006 totfarmval_1974
rename ITEM01036 cropacres_1974
label var cropacres_1974 "total cropland acres (whether or not pastured, fallow, failed, cultivated etc)"
rename ITEM01053 woodacres_1974 
label var woodacres_1974 "total woodland acres (whether pastured or not)"
keep STATE NAME STATEFIP facres_1974 farms_1974 farm1000_1974  farm500_1974 avfsize_1974 totfarmval_1974 cropacres_1974 woodacres_1974
save "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1974.dta", replace

clear
clear matrix
clear mata
set maxvar 10000

use "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\ICPSR_35206\DS0039\35206-0039-Data.dta", clear
drop if COUNTY~=0
rename ITEM01001 farms_1978
label var farms_1978 "number of farms 1978"
rename ITEM01002 facres_1978
label var facres_1978 "acres in farms 1978"
rename ITEM01003 avfsize_1978
rename ITEM01012 farm1000_1978
label var farm1000_1978 "Farms, 1000 acres and over, 1978"
rename ITEM01011 farm500_1978 
label var farm500_1978 "Farms, 500 to 999 acres, 1978"
rename ITEM01004 totfarmval_1978
rename ITEM01014 cropacres_1978
label var cropacres_1978 "total cropland acres (whether or not pastured, fallow, failed, cultivated etc)"
rename ITEM05049 woodacres_1978 
label var woodacres_1978 "total woodland acres (whether pastured or not)"
rename ITEM05057 pastacres_1978 
label var pastacres_1978 "total acres in permanent pasture and rangeland, other than cropland and woodland"
keep STATE NAME STATEFIP facres_1978 farms_1978 farm1000_1978  farm500_1978 avfsize_1978 totfarmval_1978 cropacres_1978 woodacres_1978 pastacres_1978
save "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1978.dta", replace

use "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\ICPSR_35206\DS0040\35206-0040-Data.dta", clear
drop if COUNTY~=0
rename ITEM01001 farms_1982
label var farms_1982 "number of farms 1982"
rename ITEM01002 facres_1982
label var facres_1982 "acres in farms 1982"
rename ITEM01003 avfsize_1982
rename ITEM01012 farm1000_1982
label var farm1000_1982 "Farms, 1000 acres and over, 1982"
rename ITEM01011 farm500_1982 
label var farm500_1982 "Farms, 500 to 999 acres, 1982"
gen totfarmval_1982 = farms_1982*ITEM01004
label var totfarmval_1982 "value of land & buildings, 1982"
rename ITEM01014 cropacres_1982
label var cropacres_1982 "total cropland acres (whether or not pastured, fallow, failed, cultivated etc)"
rename ITEM05049 woodacres_1982 
label var woodacres_1982 "total woodland acres (whether pastured or not)"
rename ITEM05057 pastacres_1982 
label var pastacres_1982 "total acres in permanent pasture and rangeland, other than cropland and woodland"
keep STATE NAME STATEFIP facres_1982 farms_1982 farm1000_1982  farm500_1982 avfsize_1982 totfarmval_1982 cropacres_1982 woodacres_1982 pastacres_1982
save "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1982.dta", replace

use "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\ICPSR_35206\DS0041\35206-0041-Data.dta", clear
drop if COUNTY~=0
rename ITEM01001 farms_1987
label var farms_1987 "number of farms 1987"
rename ITEM01002 facres_1987
label var facres_1987 "acres in farms 1987"
rename ITEM01003 avfsize_1987
rename ITEM01012 farm1000_1987
label var farm1000_1987 "Farms, 1000 acres and over, 1987"
rename ITEM01011 farm500_1987 
label var farm500_1987 "Farms, 500 to 999 acres, 1987"
gen totfarmval_1987 = farms_1987*ITEM01004
label var totfarmval_1987 "value of land & buildings, 1987"
rename ITEM01014 cropacres_1987
label var cropacres_1987 "total cropland acres (whether or not pastured, fallow, failed, cultivated etc)"
rename ITEM05049 woodacres_1987 
label var woodacres_1987 "total woodland acres (whether pastured or not)"
rename ITEM05057 pastacres_1987 
label var pastacres_1987 "total acres in permanent pasture and rangeland, other than cropland and woodland"
keep STATE NAME STATEFIP facres_1987 farms_1987 farm1000_1987  farm500_1987 avfsize_1987 totfarmval_1987 cropacres_1987 woodacres_1987 pastacres_1987
save "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1987.dta", replace

use "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\ICPSR_35206\DS0042\35206-0042-Data.dta", clear
drop if COUNTY~=0
rename ITEM010001 farms_1992
label var farms_1992 "number of farms 1992"
rename ITEM010002 facres_1992
label var facres_1992 "acres in farms 1992"
rename ITEM010003 avfsize_1992
rename ITEM010012 farm1000_1992
label var farm1000_1992 "Farms, 1000 acres and over, 1992"
rename ITEM010011 farm500_1992 
label var farm500_1992 "Farms, 500 to 999 acres, 1992"
gen totfarmval_1992 = farms_1992*ITEM010004
label var totfarmval_1992 "value of land & buildings, 1992"
rename ITEM010014 cropacres_1992
label var cropacres_1992 "total cropland acres (whether or not pastured, fallow, failed, cultivated etc)"
rename ITEM060061 woodacres_1992 
label var woodacres_1992 "total woodland acres (whether pastured or not)"
rename ITEM060069 pastacres_1992 
label var pastacres_1992 "total acres in permanent pasture and rangeland, other than cropland and woodland"
keep STATE NAME STATEFIP facres_1992 farms_1992 farm1000_1992  farm500_1992 avfsize_1992 totfarmval_1992 cropacres_1992 woodacres_1992 pastacres_1992
save "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1992.dta", replace

use "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\ICPSR_35206\DS0043\35206-0043-Data.dta", clear
drop if COUNTY~=0
drop if ITEM01001==.
rename ITEM01001 farms_1997
label var farms_1997 "number of farms 1997"
rename ITEM01002 facres_1997
label var facres_1997 "acres in farms 1997"
rename ITEM01003 avfsize_1997
rename ITEM01004 medfsize_1997
rename ITEM01013 farm1000_1997
label var farm1000_1997 "Farms, 1000 acres and over, 1997"
rename ITEM01012 farm500_1997 
label var farm500_1997 "Farms, 500 to 999 acres, 1997"
gen totfarmval_1997 = farms_1997*ITEM01005
label var totfarmval_1997 "value of land & buildings, 1997"
rename ITEM01015 cropacres_1997
label var cropacres_1997 "total cropland acres (whether or not pastured, fallow, failed, cultivated etc)"
rename ITEM06061 woodacres_1997 
label var woodacres_1997 "total woodland acres (whether pastured or not)"
rename ITEM06069 pastacres_1997 
label var pastacres_1997 "total acres in permanent pasture and rangeland, other than cropland and woodland"
keep STATE NAME STATEFIP facres_1997 farms_1997 farm1000_1997  farm500_1997 avfsize_1997 medfsize_1997 totfarmval_1997 cropacres_1997 woodacres_1997 pastacres_1997
save "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1997.dta", replace

use "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\ICPSR_35206\DS0044\35206-0044-Data.dta", clear
drop if COUNTY~=0
drop if ITEM01001==.
rename ITEM01001 farms_2002
label var farms_2002 "number of farms 2002"
rename ITEM01002 facres_2002
label var facres_2002 "acres in farms 2002"
rename ITEM01003 avfsize_2002
rename ITEM01004 medfsize_2002
rename ITEM01013 farm1000_2002
label var farm1000_2002 "Farms, 1000 acres and over, 2002"
rename ITEM01012 farm500_2002 
label var farm500_2002 "Farms, 500 to 999 acres, 2002"
gen totfarmval_2002 = farms_2002*ITEM01005
label var totfarmval_2002 "value of land & buildings, 2002"
rename ITEM01015 cropacres_2002 
label var cropacres_2002 "total cropland acres (whether or not pastured, fallow, failed, cultivated etc)"
rename ITEM08104 woodacres_2002 
label var woodacres_2002 "total woodland acres (whether pastured or not)"
rename ITEM08116 pastacres_2002 
label var pastacres_2002 "total acres in permanent pasture and rangeland, other than cropland and woodland"
keep STATE NAME STATEFIP facres_2002 farms_2002 farm1000_2002  farm500_2002 avfsize_2002 medfsize_2002 totfarmval_2002 cropacres_2002 woodacres_2002 pastacres_2002
save "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag2002.dta", replace

use "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\ICPSR_35206\DS0045\35206-0045-Data.dta", clear
drop if COUNTY~=0
rename DATA1_1 farms_2007
label var farms_2007 "number of farms 2007"
rename DATA1_2 facres_2007
label var facres_2007 "acres in farms 2007"
rename DATA1_3 avfsize_2007
rename DATA1_4 medfsize_2007
rename DATA1_13 farm1000_2007
label var farm1000_2007 "Farms, 1000 acres and over, 2007"
rename DATA1_12 farm500_2007 
label var farm500_2007 "Farms, 500 to 999 acres, 2007"
gen totfarmval_2007 = farms_2007*DATA1_5
label var totfarmval_2007 "value of land & buildings, 2007"
rename DATA1_15 cropacres_2007
label var cropacres_2007 "total cropland acres (whether or not pastured, fallow, failed, cultivated etc)"
rename DATA8_104 woodacres_2007
label var woodacres_2007 "total woodland acres (whether pastured or not)"
rename DATA8_116 pastacres_2007 
label var pastacres_2007 "total acres in permanent pasture and rangeland, other than cropland and woodland"
keep STATE NAME STATEFIP facres_2007 farms_2007 farm1000_2007  farm500_2007 avfsize_2007 medfsize_2007 totfarmval_2007 cropacres_2007 woodacres_2007 pastacres_2007
save "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag2007.dta", replace

****CREATING LONG PANEL OF AGRICULTURAL DATA**

use "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag2007.dta", clear

joinby STATE using "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag2002.dta", unmatched(both) 
drop _merge
joinby NAME using "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1997.dta", unmatched(both) 
drop _merge
joinby NAME using "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1992.dta", unmatched(both) 
drop _merge
joinby NAME using "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1987.dta", unmatched(both) 
drop _merge
joinby NAME using "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1982.dta", unmatched(both) 
drop _merge
joinby NAME using "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1978.dta", unmatched(both) 
drop _merge
joinby NAME using "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1974.dta", unmatched(both) 
drop _merge
joinby NAME using "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1969.dta", unmatched(both) 
drop _merge
joinby NAME using "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1964.dta", unmatched(both) 
drop _merge
joinby NAME using "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1959.dta", unmatched(both) 
drop _merge
joinby NAME using "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1954.dta", unmatched(both) 
drop _merge
joinby NAME using "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1950.dta", unmatched(both) 
drop _merge
joinby NAME using "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1945.dta", unmatched(both) 
drop _merge
joinby NAME using "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1940.dta", unmatched(both) 
drop _merge
joinby NAME using "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1935.dta", unmatched(both) 
drop _merge
joinby NAME using "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1930.dta", unmatched(both) 
drop _merge
joinby NAME using "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1920.dta", unmatched(both) 
drop _merge
joinby NAME using "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1910.dta", unmatched(both) 
drop _merge
joinby NAME using "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1900.dta", unmatched(both) 
drop _merge
joinby NAME using "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1890.dta", unmatched(both) 
drop _merge
joinby NAME using "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1880.dta", unmatched(both) 
drop _merge
joinby NAME using "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1870.dta", unmatched(both) 
drop _merge
joinby NAME using "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Haines Ag Data\Ag1860.dta", unmatched(both) 
drop _merge

drop if STATE==.
drop if STATE==100
sort NAME
quietly reshape long farms_ facres_ avfsize_ medfsize_ farm500_ farm1000_ pop_ farmpop_ fiacres_, i(STATEFIP) j(year)
drop FIPS

gen stfips=string(STATEFIP)
gen styear=string(year)
gen id = styear+stfips
destring id, replace

keep STATEFIP year STATE NAME farms_ facres_ avfsize_  farm500_ farm1000_ stfips styear id

keep if year>=1945
rename NAME name

label var facres_ "acres in farms, from Ag. Census"
label var farms_ "# of farms, from Ag. Census"
label var farm1000_ "# of farms > 1000 acres, from Ag. Census"
label var farm500_ "# of farms > 500 acres, from Ag. Census"
label var avfsize_ "av. farm size in acres, from Ag. Census"
label var stfips "state fips code"

drop STATEFIP STATE styear 
rename stfips fips
destring fips, replace

save "D:\Dropbox\Dropbox\Lueck and Parker\JAERE submission\Final Version 2024\Data and Code for Replication\Ag1945_2007.dta", replace



